function basis_function_plot(basis_type, flag)
[x, y] = meshgrid(0:0.0125:1, 0:0.0125:1);
z = basis_function_ref(x, y, basis_type);
if 1 == nargin
    Nb = size(z,1);
else
    Nb = min(size(z,1), flag);
end
triangle_region = @(x,y) (x >= 0) & (x <= 1) & (y >= 0) & (y <= 1) & (y <= -x+1);
for i = 1:Nb
    z{i}(~triangle_region(x, y)) = NaN;
    surf(x, y, z{i});
    hold on
end
end